import { subscribeWithSelector } from 'zustand/middleware'
import create from 'zustand'

type StateStore = {}

type IStore = StateStore & {
	update: (d: Partial<StateStore>) => void
	reset: () => void
}

const initialState: StateStore = {}

export const useStore = create<IStore>()(
	subscribeWithSelector((set, get) => ({
		...initialState,
		update: (d) => set({ ...d }),
		reset: () => set(initialState),
	}))
)
